package ar.com.fiuba.ElectronicCircuitAnalyst.application.api.dto;

import java.util.ArrayList;
import java.util.List;

/**
 * Data transfer object for a set of Simulation Values class. It holds:
 * 
 * @param values
 *            each entry of the "values" list, represents a set of values for a given pulse of time. 
 * 
 */
public class SimulationValuesDto {
	
	private List<List<Boolean>> values = new ArrayList<List<Boolean>>();
	
	public SimulationValuesDto(){
	}
	
	public SimulationValuesDto(List<List<Boolean>> values){
		this.values = values;
	}
	
	public void addValues(String values){
		this.values.add(convertToBooleanList(values));
	}
	
	private List<Boolean> convertToBooleanList(String booleanValues){
		List<Boolean> l = new ArrayList<Boolean>();
		for (int i = 0; i < booleanValues.length(); i++) {
			if(booleanValues.charAt(i) == '1')
				l.add(true);
			if(booleanValues.charAt(i) == '0')
				l.add(false);
		}
		return l;
	}
	
	public void setValues(List<List<Boolean>> values){
		this.values = values;
	}
	
	public List<List<Boolean>> getValues(){
		return this.values;
	}

}
